# -*-shell-script-*-

[Meta]
RootName: @magentix.gti-ia.dsic.upv.es/spade:$SOFTWAREVERSION
DisplayName: SPADE Multi-Agent Platform
ShortName: spade
Maintainer: Gustavo Aranda <garanda@dsic.upv.es>
Packager: Gustavo Aranda <garanda@dsic.upv.es>
Summary: SPADE (Smart Python multi-Agent Development Environment)
URL: http://spade.gti-ia.dsic.upv.es
License: GNU General Public License, Version 2
SoftwareVersion: 1.9.8
AutopackageTarget: 1.0

# Only uncomment InterfaceVersion if your package exposes interfaces to other software,
# for instance if it includes DSOs or python/perl modules. See the developer guide for more info,
# or ask on autopackage-dev if you don't understand interface versioning in autopackage.
#
# InterfaceVersion: 0.0

[Description]
SPADE (Smart Python multi-Agent Development Environment)

[BuildPrepare]
#prepareBuild

#[BuildUnprepare]
#unprepareBuild

[Imports]
#echo '*' | import
#echo $source_dir/* | import
import << EOF
$source_dir/configure.py
$source_dir/setup.py
$source_dir/runspade.py
$source_dir/gspade.py
$source_dir/spade.sh
$source_dir/gspade.sh
$source_dir/etc
$source_dir/readme.txt
$source_dir/doc
$source_dir/spade
$source_dir/usr
$source_dir/xmpp
$source_dir/xmppd
$source_dir/tlslite
EOF

[Prepare]
# Dependency checking
#require @whatever.you/need 1.0
requireFile /usr/bin/python
testForPythonModule distutils

[Install]
# Put your installation script here
#installExe bin/*
#echo $AUTOPACKAGE_FRONTEND
outputTest "hostname"
if [ -e /usr/bin/zenity ] && [ $AUTOPACKAGE_FRONTEND != "apkg-ttyfe" ]; then
	hostname=`zenity --entry --text "Please type the hostname" --entry-text $HOSTNAME`
#fi;
#if [ -z $hostname ]; then
else
	#S3="Your choice: "
	#OPTIONS="localhost $HOSTNAME"
	if [ -e /usr/bin/dialog ]; then
		hostname=`dialog --clear --stdout --inputbox "Please type the hostname" 10 50 $HOSTNAME`
		#OPTIONS="$OPTIONS Other..."
	else
		hostname=$HOSTNAME
	fi;
	#echo -n "Please select hostname: "
	#select opt in $OPTIONS; do
	#	if [ $opt == "Other..." ]; then
			#echo -n "Insert new hostname: "
			#read hostname|true
	#		break
	#	else
	#		hostname=$opt
	#		break
	#	fi;
	#done
fi;
outputTestPass
outputTest "SPADE pre-configuration"
python configure.py $hostname
outputTestPass
outputTest "SPADE platform installation"
python setup.py install
mv /usr/bin/spade.sh /usr/bin/spade
chmod +x /usr/bin/spade
mv /usr/bin/gspade.sh /usr/bin/gspade
chmod +x /usr/bin/gspade
outputTestPass

#installDesktop "Applications" spade.desktop

[Uninstall]
# Usually just the following line is enough to uninstall everything
rm -rf /etc/spade /usr/share/spade /usr/bin/runspade.py /usr/bin/gspade.py /usr/share/doc/spade /usr/bin/spade /usr/bin/gspade
#uninstallFromLog

